package com.java.concurrent;

import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * h
 *
 * @author wwm
 * @create 2017-04-19 13:51
 **/
public class TestExecutorMain {


    public static void  main(String[]  xargs){

        ExecutorService executor = Executors.newFixedThreadPool(3);
        for ( int i=0;  i<=10 ;i++) {

            executor.execute(new Runnable() {
                public void run() {
                    try {
                        TimeUnit.SECONDS.sleep(1);
                        String threadName = Thread.currentThread().getName();
                        System.out.println("finished: " + threadName);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            });
        }

        executor.shutdown();

    }



}
